import Vue from 'vue'
import App from './App'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import store from './store'
import axios from 'axios'

import uniRequest from 'uni-request'

Vue.prototype.$axios = axios;//把axios挂载到vue上

Vue.use(ElementUI);

Vue.config.productionTip = false

uniRequest.defaults.baseURL = 'http://localhost/bank/';

uniRequest.defaults.withCredentials=true;//让请求头携带参数cookie
// uniRequest.defaults.headers.common['Authorization'] = AUTH_TOKEN;
uniRequest.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';

App.mpType = 'app'

// 导航守卫
// 使用 router.beforeEach 注册一个全局前置守卫，判断用户是否登陆
// router.beforeEach((to, from, next) => {
// 	console.log(next.path);
// 	console.log(to.path);
//   if (to.path === '/login') {
//     next();
//   } else {
//     let token = localStorage.getItem('token');
//     if (token === 'null' || token === '') {
//       next('/login');
//     } else {
//       next();
//     }
//   }
// });

const app = new Vue({
	store,
	...App
})
app.$mount()
